/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __QS_TransactionViewWidget_H__
#define __QS_TransactionViewWidget_H__

#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QtGui/QWidget>
#include <QtGui/QLineEdit>
#include <QtGui/QTableWidget>
#include <QtGui/QDateEdit>

#include "StockInfo.h"
#include "QueryManager.h"

namespace QSThink
{
	
	class TransactionViewWidget : 
		public QWidget,public QueryListener
	{
		Q_OBJECT

	public:
		TransactionViewWidget(QWidget *parent=0,Qt::WindowFlags flag=0);
		virtual ~TransactionViewWidget();
		
		

		void setTimer();
		void timerEvent(QTimerEvent *evt);
		
	public:
		void OnStockInfoReceived(StockInfo info);
		void OnDayTransactionReceived(Transaction1Day* info);

		
		//=0;

	protected:
		QLineEdit* _lineEditSymbol;
		QTableWidget* _dataTable;
		QDateEdit* _dateEdit;

	protected:
		unsigned int _lastTime;
		float _frameRate;
		bool _inited;


	protected:
		std::map<int,StockInfo> _stockInfoMap;//search by symbol
	public slots:
		void symbolBtnClicked();
	protected:
		void loadPortfolio();
		void addTransaction(int index, TransactionSingle* t );



	};
}
#endif
